package org.project

import groovy.sql.Sql
class UserController{
	//figure out how to link this to the crawler interface
	def index(){}
	
	def login(){//maybe specifically take in username & password?
	//See how it interacts with the database to grab information to check against
		if(params.username == "test1" && params.password == "passwordTest"){
			session.user = "test1"
			//now redirect to the crawler front page.
		}
		else if(params.username == "test1" && params.password != "passwordTest")//check against database
			render "Incorrect Password"
		else if(params.username != "test1" && params.password == "passwordTest")//check against database
			render "Incorrect User Name"
		else//Both are incorrect
			render "Incorrect User Name & Password"
			
		redirect(action:index) //Specifically the front log in, but unsure if i need to move it around.
	}
	
	def logout(){
		session.user = null
		redirect(action:index)//the log in screen!
	}
}